﻿#include "Server.QuestInfoForm.h"
#include "../Server.SMain.h"
#include "../../Shared/Enums.h"

using namespace Server::MirDatabase;
using namespace Server::MirEnvir;

namespace Server
{

    Server::MirEnvir::Envir *QuestInfoForm::getEnvir() const
    {
        return SMain::getEditEnvir();
    }

    QuestInfoForm::QuestInfoForm()
    {
        InitializeComponent();

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        QTypeComboBox->Items->AddRange(Enum::GetValues(typeof(QuestType))->Cast<std::any>()->ToArray());
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        RequiredClassComboBox->Items->AddRange(Enum::GetValues(typeof(RequiredClass))->Cast<std::any>()->ToArray());

        UpdateInterface();
    }

    void QuestInfoForm::AddButton_Click(std::any sender, EventArgs *e)
    {
        getEnvir()->CreateQuestInfo();
        UpdateInterface();
    }

    void QuestInfoForm::RemoveButton_Click(std::any sender, EventArgs *e)
    {
        if (_selectedQuestInfos.empty())
        {
            return;
        }

        if (MessageBox::Show("Are you sure you want to remove the selected Quests?", "Remove Quests?", MessageBoxButtons::YesNo) != System::Windows::Forms::DialogResult::Yes)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            getEnvir()->Remove(_selectedQuestInfos[i]);
        }

        if (getEnvir()->QuestInfoList.empty())
        {
            getEnvir()->QuestIndex = 0;
        }

        UpdateInterface();
    }

    void QuestInfoForm::UpdateInterface()
    {
        if (QuestInfoListBox->Items->Count != getEnvir()->QuestInfoList.size())
        {
            QuestInfoListBox->Items->Clear();
            RequiredQuestComboBox->Items->Clear();

            QuestInfo *tempVar = new QuestInfo();
            tempVar->Index = 0;
            tempVar->Name = "None";
            RequiredQuestComboBox->Items->Add(tempVar);

            for (int i = 0; i < getEnvir()->QuestInfoList.size(); i++)
            {
                QuestInfoListBox->Items->Add(getEnvir()->QuestInfoList[i]);
                RequiredQuestComboBox->Items->Add(getEnvir()->QuestInfoList[i]);
            }

//C# TO C++ CONVERTER TODO TASK: A 'delete tempVar' statement was not added since tempVar was passed to a method or constructor. Handle memory management manually.
        }

        _selectedQuestInfos = QuestInfoListBox->SelectedItems.Cast<QuestInfo*>().ToList();

        if (_selectedQuestInfos.empty())
        {
            QuestInfoPanel->Enabled = false;
            QuestIndexTextBox->Text = "";
            QFileNameTextBox->Text = "";
            QNameTextBox->Text = "";
            QGroupTextBox->Text = "";
            QTypeComboBox->SelectedItem = nullptr;

            QGotoTextBox->Text = "";
            QKillTextBox->Text = "";
            QItemTextBox->Text = "";
            QFlagTextBox->Text = "";

            RequiredMinLevelTextBox->Text = "";
            RequiredMaxLevelTextBox->Text = "";
            RequiredQuestComboBox->SelectedItem = nullptr;
            RequiredClassComboBox->SelectedItem = nullptr;

            return;
        }

        QuestInfo *info = _selectedQuestInfos[0];

        QuestInfoPanel->Enabled = true;
        QuestIndexTextBox->Text = std::to_string(info->Index);
        QFileNameTextBox->Text = info->FileName;
        QNameTextBox->Text = info->Name;
        QGroupTextBox->Text = info->Group;
        QTypeComboBox->SelectedItem = info->Type;

        QGotoTextBox->Text = info->GotoMessage;
        QKillTextBox->Text = info->KillMessage;
        QItemTextBox->Text = info->ItemMessage;
        QFlagTextBox->Text = info->FlagMessage;

        RequiredMinLevelTextBox->Text = std::to_string(info->RequiredMinLevel);
        RequiredMaxLevelTextBox->Text = std::to_string(info->RequiredMaxLevel);

        if (std::stoi(RequiredMaxLevelTextBox->Text) <= 0)
        {
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
            RequiredMaxLevelTextBox->Text = std::numeric_limits<unsigned char>::max().ToString();
        }

        QuestInfo *tempQuest = getEnvir()->QuestInfoList.FirstOrDefault([&] (std::any c)
        {
            return c->Index == info->RequiredQuest;
        });

        if (tempQuest == nullptr)
        {
            tempQuest = static_cast<QuestInfo*>(RequiredQuestComboBox->Items[0]);
        }

        RequiredQuestComboBox->SelectedItem = tempQuest; //test
        RequiredClassComboBox->SelectedItem = info->RequiredClass;

        for (int i = 1; i < _selectedQuestInfos.size(); i++)
        {
            info = _selectedQuestInfos[i];

            if (QFileNameTextBox->Text != info->FileName)
            {
                QFileNameTextBox->Text = "";
            }
            if (QNameTextBox->Text != info->Name)
            {
                QNameTextBox->Text = "";
            }
            if (QGroupTextBox->Text != info->Group)
            {
                QGroupTextBox->Text = "";
            }

            if (QTypeComboBox->SelectedItem != nullptr)
            {
                if (static_cast<QuestType>(QTypeComboBox->SelectedItem) != info->Type)
                {
                    QTypeComboBox->SelectedItem = nullptr;
                }
            }

            if (QGotoTextBox->Text != info->GotoMessage)
            {
                QGotoTextBox->Text = "";
            }
            if (QKillTextBox->Text != info->KillMessage)
            {
                QKillTextBox->Text = "";
            }
            if (QItemTextBox->Text != info->ItemMessage)
            {
                QItemTextBox->Text = "";
            }
            if (QFlagTextBox->Text != info->ItemMessage)
            {
                QFlagTextBox->Text = "";
            }

            if (RequiredMinLevelTextBox->Text != std::to_string(info->RequiredMinLevel))
            {
                RequiredMinLevelTextBox->Text = "";
            }
            if (RequiredMaxLevelTextBox->Text != std::to_string(info->RequiredMaxLevel))
            {
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
                RequiredMaxLevelTextBox->Text = std::numeric_limits<unsigned char>::max().ToString();
            }

            if (RequiredQuestComboBox->SelectedValue != nullptr)
            {
                if (static_cast<std::string>(RequiredQuestComboBox->SelectedValue) != std::to_string(info->RequiredQuest))
                {
                    RequiredQuestComboBox->SelectedItem = nullptr;
                }
            }

            if (RequiredClassComboBox->SelectedItem != nullptr)
            {
                if (static_cast<RequiredClass>(RequiredClassComboBox->SelectedItem) != info->RequiredClass)
                {
                    RequiredClassComboBox->SelectedItem = nullptr;
                }
            }
        }
    }

    void QuestInfoForm::RefreshQuestList()
    {
        QuestInfoListBox->SelectedIndexChanged -= QuestInfoListBox_SelectedIndexChanged;

        std::vector<bool> selected;

        for (int i = 0; i < QuestInfoListBox->Items->Count; i++)
        {
            selected.push_back(QuestInfoListBox->GetSelected(i));
        }
        QuestInfoListBox->Items->Clear();
        for (int i = 0; i < getEnvir()->QuestInfoList.size(); i++)
        {
            QuestInfoListBox->Items->Add(getEnvir()->QuestInfoList[i]);
        }
        for (int i = 0; i < selected.size(); i++)
        {
            QuestInfoListBox->SetSelected(i, selected[i]);
        }

        QuestInfoListBox->SelectedIndexChanged += QuestInfoListBox_SelectedIndexChanged;

    }

    void QuestInfoForm::QuestInfoListBox_SelectedIndexChanged(std::any sender, EventArgs *e)
    {
        UpdateInterface();
    }

    void QuestInfoForm::QuestInfoForm_FormClosed(std::any sender, FormClosedEventArgs *e)
    {
        getEnvir()->SaveDB();
    }

    void QuestInfoForm::PasteMButton_Click(std::any sender, EventArgs *e)
    {
        std::string data = Clipboard::GetText();

        if (!data.StartsWith("Quest", StringComparison::OrdinalIgnoreCase))
        {
            MessageBox::Show("Cannot Paste, Copied data is not Quest Information.");
            return;
        }


        std::vector<std::string> npcs = data.Split({'\t'}, StringSplitOptions::RemoveEmptyEntries);


        //for (int i = 1; i < npcs.Length; i++)
        //    NPCInfo.FromText(npcs[i]);

        UpdateInterface();
    }

    void QuestInfoForm::ExportAllButton_Click(std::any sender, EventArgs *e)
    {
        ExportQuests(getEnvir()->QuestInfoList);
    }

    void QuestInfoForm::ExportSelected_Click(std::any sender, EventArgs *e)
    {
        auto list = QuestInfoListBox->SelectedItems.Cast<QuestInfo*>().ToList();

        ExportQuests(list);
    }

    void QuestInfoForm::ExportQuests(std::vector<QuestInfo*> &Quests)
    {
        if (Quests.empty())
        {
            return;
        }

        SaveFileDialog *sfd = new SaveFileDialog();
        sfd->InitialDirectory = FileSystem::combine(Application::StartupPath, "Exports");
        sfd->Filter = "Text File|*.txt";
        sfd->ShowDialog();

        if (sfd->FileName == "")
        {
            delete sfd;
            return;
        }

//C# TO C++ CONVERTER NOTE: The following 'using' block is replaced by its C++ equivalent:
//ORIGINAL LINE: using (StreamWriter sw = File.AppendText(sfd.FileNames[0]))
        {
            StreamWriter sw = File::AppendText(sfd->FileNames[0]);
            for (int j = 0; j < Quests.size(); j++)
            {
                sw.WriteLine(Quests[j]->ToText());
            }
        }
        MessageBox::Show("Quest Export complete");

        delete sfd;
    }

    void QuestInfoForm::ImportButton_Click(std::any sender, EventArgs *e)
    {
        std::string Path = "";

        OpenFileDialog *ofd = new OpenFileDialog();
        ofd->Filter = "Text File|*.txt";
        ofd->ShowDialog();

        if (ofd->FileName == "")
        {
            delete ofd;
            return;
        }

        Path = ofd->FileName;

        std::string data;
//C# TO C++ CONVERTER NOTE: The following 'using' block is replaced by its C++ equivalent:
//ORIGINAL LINE: using (var sr = new StreamReader(Path))
        {
            auto sr = StreamReader(Path);
            data = sr.ReadToEnd();
        }

        auto quests = data.Split(std::vector<std::string> {"\r\n"}, StringSplitOptions::RemoveEmptyEntries);

        for (auto m : quests)
        {
            QuestInfo::FromText(m);
        }

        UpdateInterface();
        MessageBox::Show("Quest Import complete");

        delete ofd;
    }

    void QuestInfoForm::QNameTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->Name = ActiveControl->Text;
        }

        RefreshQuestList();
    }

    void QuestInfoForm::QGroupTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->Group = ActiveControl->Text;
        }
    }

    void QuestInfoForm::QTypeComboBox_SelectedIndexChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->Type = static_cast<QuestType>(QTypeComboBox->SelectedItem);
        }
    }

    void QuestInfoForm::QFileNameTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->FileName = ActiveControl->Text;
        }

    }

    void QuestInfoForm::QGotoTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->GotoMessage = ActiveControl->Text;
        }

    }

    void QuestInfoForm::QKillTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->KillMessage = ActiveControl->Text;
        }

    }

    void QuestInfoForm::QItemTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->ItemMessage = ActiveControl->Text;
        }
    }

    void QuestInfoForm::QFlagTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->FlagMessage = ActiveControl->Text;
        }
    }

    void QuestInfoForm::RequiredMinLevelTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        int temp;

        if (!int::TryParse(ActiveControl->Text, temp) || temp > std::stoi(RequiredMaxLevelTextBox->Text) || temp < std::numeric_limits<unsigned char>::min())
        {
            ActiveControl->BackColor = Color::Red;
            return;
        }
        ActiveControl->BackColor = SystemColors::Window;

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->RequiredMinLevel = temp;
        }
    }

    void QuestInfoForm::RequiredMaxLevelTextBox_TextChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        int temp;

        if (!int::TryParse(ActiveControl->Text, temp) || temp < std::stoi(RequiredMinLevelTextBox->Text) || temp > std::numeric_limits<unsigned char>::max())
        {
            ActiveControl->BackColor = Color::Red;
            return;
        }
        ActiveControl->BackColor = SystemColors::Window;

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->RequiredMaxLevel = temp;
        }
    }

    void QuestInfoForm::RequiredQuestComboBox_SelectedIndexChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            QuestInfo *temp = static_cast<QuestInfo*>(RequiredQuestComboBox->SelectedItem);

            _selectedQuestInfos[i]->RequiredQuest = temp->Index;
        }
    }

    void QuestInfoForm::RequiredClassComboBox_SelectedIndexChanged(std::any sender, EventArgs *e)
    {
        if (ActiveControl != sender)
        {
            return;
        }

        for (int i = 0; i < _selectedQuestInfos.size(); i++)
        {
            _selectedQuestInfos[i]->RequiredClass = static_cast<RequiredClass>(RequiredClassComboBox->SelectedItem);
        }
    }

    void QuestInfoForm::OpenQButton_Click(std::any sender, EventArgs *e)
    {
        if (QFileNameTextBox->Text == "")
        {
            return;
        }

        auto scriptPath = FileSystem::combine(Settings::QuestPath, QFileNameTextBox->Text + ".txt");

        if (FileSystem::fileExists(scriptPath))
        {
            Process::Start(scriptPath);
        }
        else
        {
            FileSystem::createDirectory(FileSystem::getDirectoryName(scriptPath));

            File::Create(scriptPath)->Close();

            File::WriteAllText(scriptPath, std::string::Format("{0}\r\n\r\n{1}\r\n\r\n{2}\r\n\r\n{3}\r\n\r\n{4}\r\n\r\n{5}\r\n\r\n{6}\r\n\r\n{7}\r\n\r\n{8}\r\n\r\n{9}\r\n\r\n{10}", "[@Description]", "[@TaskDescription]", "[@Completion]", "[@KillTasks]", "[@ItemTasks]", "[@FlagTasks]", "[@CarryItems]", "[@FixedRewards]", "[@SelectRewards]", "[@ExpReward]", "[@GoldReward]"));

            Process::Start(scriptPath);
        }
    }

    void QuestInfoForm::Dispose(bool disposing)
    {
        if (disposing && (components != nullptr))
        {
            components->Dispose();
        }
        System::Windows::Forms::Form::Dispose(disposing);
    }

    void QuestInfoForm::InitializeComponent()
    {
        this->tabControl1 = new System::Windows::Forms::TabControl();
        this->tabPage1 = new System::Windows::Forms::TabPage();
        this->QuestInfoPanel = new System::Windows::Forms::Panel();
        this->label4 = new System::Windows::Forms::Label();
        this->RequiredMaxLevelTextBox = new System::Windows::Forms::TextBox();
        this->label3 = new System::Windows::Forms::Label();
        this->QFlagTextBox = new System::Windows::Forms::TextBox();
        this->label14 = new System::Windows::Forms::Label();
        this->label12 = new System::Windows::Forms::Label();
        this->label10 = new System::Windows::Forms::Label();
        this->QItemTextBox = new System::Windows::Forms::TextBox();
        this->QKillTextBox = new System::Windows::Forms::TextBox();
        this->QGotoTextBox = new System::Windows::Forms::TextBox();
        this->label9 = new System::Windows::Forms::Label();
        this->label8 = new System::Windows::Forms::Label();
        this->label7 = new System::Windows::Forms::Label();
        this->RequiredClassComboBox = new System::Windows::Forms::ComboBox();
        this->RequiredQuestComboBox = new System::Windows::Forms::ComboBox();
        this->RequiredMinLevelTextBox = new System::Windows::Forms::TextBox();
        this->label2 = new System::Windows::Forms::Label();
        this->QTypeComboBox = new System::Windows::Forms::ComboBox();
        this->label11 = new System::Windows::Forms::Label();
        this->OpenQButton = new System::Windows::Forms::Button();
        this->QFileNameTextBox = new System::Windows::Forms::TextBox();
        this->label29 = new System::Windows::Forms::Label();
        this->QGroupTextBox = new System::Windows::Forms::TextBox();
        this->QNameTextBox = new System::Windows::Forms::TextBox();
        this->label13 = new System::Windows::Forms::Label();
        this->QuestIndexTextBox = new System::Windows::Forms::TextBox();
        this->label1 = new System::Windows::Forms::Label();
        this->RemoveButton = new System::Windows::Forms::Button();
        this->AddButton = new System::Windows::Forms::Button();
        this->QuestInfoListBox = new System::Windows::Forms::ListBox();
        this->PasteMButton = new System::Windows::Forms::Button();
        this->CopyMButton = new System::Windows::Forms::Button();
        this->ExportButton = new System::Windows::Forms::Button();
        this->ImportButton = new System::Windows::Forms::Button();
        this->ExportSelectedButton = new System::Windows::Forms::Button();
        this->tabControl1->SuspendLayout();
        this->tabPage1->SuspendLayout();
        this->QuestInfoPanel->SuspendLayout();
        this->SuspendLayout();
        // 
        // tabControl1
        // 
        this->tabControl1->Anchor = (static_cast<System::Windows::Forms::AnchorStyles*>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right)));
        this->tabControl1->Controls->Add(this->tabPage1);
        this->tabControl1->Location = new System::Drawing::Point(174, 41);
        this->tabControl1->Name = "tabControl1";
        this->tabControl1->SelectedIndex = 0;
        this->tabControl1->Size = new System::Drawing::Size(602, 287);
        this->tabControl1->TabIndex = 16;
        // 
        // tabPage1
        // 
        this->tabPage1->Controls->Add(this->QuestInfoPanel);
        this->tabPage1->Location = new System::Drawing::Point(4, 22);
        this->tabPage1->Name = "tabPage1";
        this->tabPage1->Padding = new System::Windows::Forms::Padding(3);
        this->tabPage1->Size = new System::Drawing::Size(594, 261);
        this->tabPage1->TabIndex = 0;
        this->tabPage1->Text = "Info";
        this->tabPage1->UseVisualStyleBackColor = true;
        // 
        // QuestInfoPanel
        // 
        this->QuestInfoPanel->Anchor = (static_cast<System::Windows::Forms::AnchorStyles*>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right)));
        this->QuestInfoPanel->Controls->Add(this->label4);
        this->QuestInfoPanel->Controls->Add(this->RequiredMaxLevelTextBox);
        this->QuestInfoPanel->Controls->Add(this->label3);
        this->QuestInfoPanel->Controls->Add(this->QFlagTextBox);
        this->QuestInfoPanel->Controls->Add(this->label14);
        this->QuestInfoPanel->Controls->Add(this->label12);
        this->QuestInfoPanel->Controls->Add(this->label10);
        this->QuestInfoPanel->Controls->Add(this->QItemTextBox);
        this->QuestInfoPanel->Controls->Add(this->QKillTextBox);
        this->QuestInfoPanel->Controls->Add(this->QGotoTextBox);
        this->QuestInfoPanel->Controls->Add(this->label9);
        this->QuestInfoPanel->Controls->Add(this->label8);
        this->QuestInfoPanel->Controls->Add(this->label7);
        this->QuestInfoPanel->Controls->Add(this->RequiredClassComboBox);
        this->QuestInfoPanel->Controls->Add(this->RequiredQuestComboBox);
        this->QuestInfoPanel->Controls->Add(this->RequiredMinLevelTextBox);
        this->QuestInfoPanel->Controls->Add(this->label2);
        this->QuestInfoPanel->Controls->Add(this->QTypeComboBox);
        this->QuestInfoPanel->Controls->Add(this->label11);
        this->QuestInfoPanel->Controls->Add(this->OpenQButton);
        this->QuestInfoPanel->Controls->Add(this->QFileNameTextBox);
        this->QuestInfoPanel->Controls->Add(this->label29);
        this->QuestInfoPanel->Controls->Add(this->QGroupTextBox);
        this->QuestInfoPanel->Controls->Add(this->QNameTextBox);
        this->QuestInfoPanel->Controls->Add(this->label13);
        this->QuestInfoPanel->Controls->Add(this->QuestIndexTextBox);
        this->QuestInfoPanel->Controls->Add(this->label1);
        this->QuestInfoPanel->Enabled = false;
        this->QuestInfoPanel->Location = new System::Drawing::Point(3, 6);
        this->QuestInfoPanel->Name = "QuestInfoPanel";
        this->QuestInfoPanel->Size = new System::Drawing::Size(585, 249);
        this->QuestInfoPanel->TabIndex = 11;
        // 
        // label4
        // 
        this->label4->AutoSize = true;
        this->label4->Location = new System::Drawing::Point(349, 33);
        this->label4->Name = "label4";
        this->label4->Size = new System::Drawing::Size(105, 13);
        this->label4->TabIndex = 57;
        this->label4->Text = "Required Max Level:";
        // 
        // RequiredMaxLevelTextBox
        // 
        this->RequiredMaxLevelTextBox->Location = new System::Drawing::Point(456, 28);
        this->RequiredMaxLevelTextBox->MaxLength = 3;
        this->RequiredMaxLevelTextBox->Name = "RequiredMaxLevelTextBox";
        this->RequiredMaxLevelTextBox->Size = new System::Drawing::Size(121, 20);
        this->RequiredMaxLevelTextBox->TabIndex = 56;
        this->RequiredMaxLevelTextBox->TextChanged += new System::EventHandler(this->RequiredMaxLevelTextBox_TextChanged);
        // 
        // label3
        // 
        this->label3->AutoSize = true;
        this->label3->Location = new System::Drawing::Point(27, 220);
        this->label3->Name = "label3";
        this->label3->Size = new System::Drawing::Size(54, 13);
        this->label3->TabIndex = 55;
        this->label3->Text = "Flag Text:";
        // 
        // QFlagTextBox
        // 
        this->QFlagTextBox->Location = new System::Drawing::Point(87, 217);
        this->QFlagTextBox->Name = "QFlagTextBox";
        this->QFlagTextBox->Size = new System::Drawing::Size(180, 20);
        this->QFlagTextBox->TabIndex = 54;
        this->QFlagTextBox->TextChanged += new System::EventHandler(this->QFlagTextBox_TextChanged);
        // 
        // label14
        // 
        this->label14->AutoSize = true;
        this->label14->Location = new System::Drawing::Point(27, 193);
        this->label14->Name = "label14";
        this->label14->Size = new System::Drawing::Size(54, 13);
        this->label14->TabIndex = 53;
        this->label14->Text = "Item Text:";
        // 
        // label12
        // 
        this->label12->AutoSize = true;
        this->label12->Location = new System::Drawing::Point(34, 166);
        this->label12->Name = "label12";
        this->label12->Size = new System::Drawing::Size(47, 13);
        this->label12->TabIndex = 52;
        this->label12->Text = "Kill Text:";
        // 
        // label10
        // 
        this->label10->AutoSize = true;
        this->label10->Location = new System::Drawing::Point(24, 139);
        this->label10->Name = "label10";
        this->label10->Size = new System::Drawing::Size(57, 13);
        this->label10->TabIndex = 51;
        this->label10->Text = "Goto Text:";
        // 
        // QItemTextBox
        // 
        this->QItemTextBox->Location = new System::Drawing::Point(87, 190);
        this->QItemTextBox->Name = "QItemTextBox";
        this->QItemTextBox->Size = new System::Drawing::Size(180, 20);
        this->QItemTextBox->TabIndex = 49;
        this->QItemTextBox->TextChanged += new System::EventHandler(this->QItemTextBox_TextChanged);
        // 
        // QKillTextBox
        // 
        this->QKillTextBox->Location = new System::Drawing::Point(87, 163);
        this->QKillTextBox->Name = "QKillTextBox";
        this->QKillTextBox->Size = new System::Drawing::Size(180, 20);
        this->QKillTextBox->TabIndex = 48;
        this->QKillTextBox->TextChanged += new System::EventHandler(this->QKillTextBox_TextChanged);
        // 
        // QGotoTextBox
        // 
        this->QGotoTextBox->Location = new System::Drawing::Point(87, 136);
        this->QGotoTextBox->Name = "QGotoTextBox";
        this->QGotoTextBox->Size = new System::Drawing::Size(180, 20);
        this->QGotoTextBox->TabIndex = 47;
        this->QGotoTextBox->TextChanged += new System::EventHandler(this->QGotoTextBox_TextChanged);
        // 
        // label9
        // 
        this->label9->AutoSize = true;
        this->label9->Location = new System::Drawing::Point(373, 85);
        this->label9->Name = "label9";
        this->label9->Size = new System::Drawing::Size(81, 13);
        this->label9->TabIndex = 46;
        this->label9->Text = "Required Class:";
        // 
        // label8
        // 
        this->label8->AutoSize = true;
        this->label8->Location = new System::Drawing::Point(370, 59);
        this->label8->Name = "label8";
        this->label8->Size = new System::Drawing::Size(84, 13);
        this->label8->TabIndex = 45;
        this->label8->Text = "Required Quest:";
        // 
        // label7
        // 
        this->label7->AutoSize = true;
        this->label7->Location = new System::Drawing::Point(352, 7);
        this->label7->Name = "label7";
        this->label7->Size = new System::Drawing::Size(102, 13);
        this->label7->TabIndex = 44;
        this->label7->Text = "Required Min Level:";
        // 
        // RequiredClassComboBox
        // 
        this->RequiredClassComboBox->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
        this->RequiredClassComboBox->FormattingEnabled = true;
        this->RequiredClassComboBox->Location = new System::Drawing::Point(456, 82);
        this->RequiredClassComboBox->Name = "RequiredClassComboBox";
        this->RequiredClassComboBox->Size = new System::Drawing::Size(121, 21);
        this->RequiredClassComboBox->TabIndex = 43;
        this->RequiredClassComboBox->SelectedIndexChanged += new System::EventHandler(this->RequiredClassComboBox_SelectedIndexChanged);
        // 
        // RequiredQuestComboBox
        // 
        this->RequiredQuestComboBox->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
        this->RequiredQuestComboBox->FormattingEnabled = true;
        this->RequiredQuestComboBox->Location = new System::Drawing::Point(456, 54);
        this->RequiredQuestComboBox->Name = "RequiredQuestComboBox";
        this->RequiredQuestComboBox->Size = new System::Drawing::Size(121, 21);
        this->RequiredQuestComboBox->TabIndex = 42;
        this->RequiredQuestComboBox->SelectedIndexChanged += new System::EventHandler(this->RequiredQuestComboBox_SelectedIndexChanged);
        // 
        // RequiredMinLevelTextBox
        // 
        this->RequiredMinLevelTextBox->Location = new System::Drawing::Point(456, 4);
        this->RequiredMinLevelTextBox->MaxLength = 3;
        this->RequiredMinLevelTextBox->Name = "RequiredMinLevelTextBox";
        this->RequiredMinLevelTextBox->Size = new System::Drawing::Size(121, 20);
        this->RequiredMinLevelTextBox->TabIndex = 41;
        this->RequiredMinLevelTextBox->TextChanged += new System::EventHandler(this->RequiredMinLevelTextBox_TextChanged);
        // 
        // label2
        // 
        this->label2->AutoSize = true;
        this->label2->Location = new System::Drawing::Point(47, 85);
        this->label2->Name = "label2";
        this->label2->Size = new System::Drawing::Size(34, 13);
        this->label2->TabIndex = 32;
        this->label2->Text = "Type:";
        // 
        // QTypeComboBox
        // 
        this->QTypeComboBox->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
        this->QTypeComboBox->FormattingEnabled = true;
        this->QTypeComboBox->Location = new System::Drawing::Point(87, 82);
        this->QTypeComboBox->Name = "QTypeComboBox";
        this->QTypeComboBox->Size = new System::Drawing::Size(180, 21);
        this->QTypeComboBox->TabIndex = 31;
        this->QTypeComboBox->SelectedIndexChanged += new System::EventHandler(this->QTypeComboBox_SelectedIndexChanged);
        // 
        // label11
        // 
        this->label11->AutoSize = true;
        this->label11->Location = new System::Drawing::Point(24, 112);
        this->label11->Name = "label11";
        this->label11->Size = new System::Drawing::Size(57, 13);
        this->label11->TabIndex = 23;
        this->label11->Text = "File Name:";
        // 
        // OpenQButton
        // 
        this->OpenQButton->Location = new System::Drawing::Point(277, 107);
        this->OpenQButton->Name = "OpenQButton";
        this->OpenQButton->Size = new System::Drawing::Size(75, 23);
        this->OpenQButton->TabIndex = 30;
        this->OpenQButton->Text = "Open Script";
        this->OpenQButton->UseVisualStyleBackColor = true;
        this->OpenQButton->Click += new System::EventHandler(this->OpenQButton_Click);
        // 
        // QFileNameTextBox
        // 
        this->QFileNameTextBox->Location = new System::Drawing::Point(87, 109);
        this->QFileNameTextBox->Name = "QFileNameTextBox";
        this->QFileNameTextBox->Size = new System::Drawing::Size(180, 20);
        this->QFileNameTextBox->TabIndex = 22;
        this->QFileNameTextBox->TextChanged += new System::EventHandler(this->QFileNameTextBox_TextChanged);
        // 
        // label29
        // 
        this->label29->AutoSize = true;
        this->label29->Cursor = System::Windows::Forms::Cursors::Default;
        this->label29->Location = new System::Drawing::Point(42, 59);
        this->label29->Name = "label29";
        this->label29->Size = new System::Drawing::Size(39, 13);
        this->label29->TabIndex = 21;
        this->label29->Text = "Group:";
        // 
        // QGroupTextBox
        // 
        this->QGroupTextBox->Location = new System::Drawing::Point(87, 56);
        this->QGroupTextBox->MaxLength = 20;
        this->QGroupTextBox->Name = "QGroupTextBox";
        this->QGroupTextBox->Size = new System::Drawing::Size(180, 20);
        this->QGroupTextBox->TabIndex = 20;
        this->QGroupTextBox->TextChanged += new System::EventHandler(this->QGroupTextBox_TextChanged);
        // 
        // QNameTextBox
        // 
        this->QNameTextBox->Location = new System::Drawing::Point(87, 30);
        this->QNameTextBox->MaxLength = 30;
        this->QNameTextBox->Name = "QNameTextBox";
        this->QNameTextBox->Size = new System::Drawing::Size(180, 20);
        this->QNameTextBox->TabIndex = 14;
        this->QNameTextBox->TextChanged += new System::EventHandler(this->QNameTextBox_TextChanged);
        // 
        // label13
        // 
        this->label13->AutoSize = true;
        this->label13->Location = new System::Drawing::Point(43, 33);
        this->label13->Name = "label13";
        this->label13->Size = new System::Drawing::Size(38, 13);
        this->label13->TabIndex = 15;
        this->label13->Text = "Name:";
        // 
        // QuestIndexTextBox
        // 
        this->QuestIndexTextBox->Location = new System::Drawing::Point(87, 4);
        this->QuestIndexTextBox->Name = "QuestIndexTextBox";
        this->QuestIndexTextBox->ReadOnly = true;
        this->QuestIndexTextBox->Size = new System::Drawing::Size(47, 20);
        this->QuestIndexTextBox->TabIndex = 0;
        // 
        // label1
        // 
        this->label1->AutoSize = true;
        this->label1->Location = new System::Drawing::Point(14, 7);
        this->label1->Name = "label1";
        this->label1->Size = new System::Drawing::Size(67, 13);
        this->label1->TabIndex = 4;
        this->label1->Text = "Quest Index:";
        // 
        // RemoveButton
        // 
        this->RemoveButton->Location = new System::Drawing::Point(93, 12);
        this->RemoveButton->Name = "RemoveButton";
        this->RemoveButton->Size = new System::Drawing::Size(75, 23);
        this->RemoveButton->TabIndex = 14;
        this->RemoveButton->Text = "Remove";
        this->RemoveButton->UseVisualStyleBackColor = true;
        this->RemoveButton->Click += new System::EventHandler(this->RemoveButton_Click);
        // 
        // AddButton
        // 
        this->AddButton->Location = new System::Drawing::Point(12, 12);
        this->AddButton->Name = "AddButton";
        this->AddButton->Size = new System::Drawing::Size(75, 23);
        this->AddButton->TabIndex = 13;
        this->AddButton->Text = "Add";
        this->AddButton->UseVisualStyleBackColor = true;
        this->AddButton->Click += new System::EventHandler(this->AddButton_Click);
        // 
        // QuestInfoListBox
        // 
        this->QuestInfoListBox->Anchor = (static_cast<System::Windows::Forms::AnchorStyles*>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left)));
        this->QuestInfoListBox->FormattingEnabled = true;
        this->QuestInfoListBox->Location = new System::Drawing::Point(12, 41);
        this->QuestInfoListBox->Name = "QuestInfoListBox";
        this->QuestInfoListBox->SelectionMode = System::Windows::Forms::SelectionMode::MultiExtended;
        this->QuestInfoListBox->Size = new System::Drawing::Size(156, 277);
        this->QuestInfoListBox->TabIndex = 15;
        this->QuestInfoListBox->SelectedIndexChanged += new System::EventHandler(this->QuestInfoListBox_SelectedIndexChanged);
        // 
        // PasteMButton
        // 
        this->PasteMButton->Location = new System::Drawing::Point(255, 12);
        this->PasteMButton->Name = "PasteMButton";
        this->PasteMButton->Size = new System::Drawing::Size(75, 23);
        this->PasteMButton->TabIndex = 22;
        this->PasteMButton->Text = "Paste";
        this->PasteMButton->UseVisualStyleBackColor = true;
        this->PasteMButton->Click += new System::EventHandler(this->PasteMButton_Click);
        // 
        // CopyMButton
        // 
        this->CopyMButton->Location = new System::Drawing::Point(174, 12);
        this->CopyMButton->Name = "CopyMButton";
        this->CopyMButton->Size = new System::Drawing::Size(75, 23);
        this->CopyMButton->TabIndex = 21;
        this->CopyMButton->Text = "Copy";
        this->CopyMButton->UseVisualStyleBackColor = true;
        // 
        // ExportButton
        // 
        this->ExportButton->Location = new System::Drawing::Point(701, 12);
        this->ExportButton->Name = "ExportButton";
        this->ExportButton->Size = new System::Drawing::Size(75, 23);
        this->ExportButton->TabIndex = 23;
        this->ExportButton->Text = "Export All";
        this->ExportButton->UseVisualStyleBackColor = true;
        this->ExportButton->Click += new System::EventHandler(this->ExportAllButton_Click);
        // 
        // ImportButton
        // 
        this->ImportButton->Location = new System::Drawing::Point(498, 12);
        this->ImportButton->Name = "ImportButton";
        this->ImportButton->Size = new System::Drawing::Size(75, 23);
        this->ImportButton->TabIndex = 24;
        this->ImportButton->Text = "Import";
        this->ImportButton->UseVisualStyleBackColor = true;
        this->ImportButton->Click += new System::EventHandler(this->ImportButton_Click);
        // 
        // ExportSelectedButton
        // 
        this->ExportSelectedButton->Location = new System::Drawing::Point(578, 12);
        this->ExportSelectedButton->Name = "ExportSelectedButton";
        this->ExportSelectedButton->Size = new System::Drawing::Size(117, 23);
        this->ExportSelectedButton->TabIndex = 25;
        this->ExportSelectedButton->Text = "Export Selected";
        this->ExportSelectedButton->UseVisualStyleBackColor = true;
        this->ExportSelectedButton->Click += new System::EventHandler(this->ExportSelected_Click);
        // 
        // QuestInfoForm
        // 
        this->AutoScaleDimensions = new System::Drawing::SizeF(6.0F, 13.0F);
        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
        this->ClientSize = new System::Drawing::Size(788, 333);
        this->Controls->Add(this->ExportSelectedButton);
        this->Controls->Add(this->ImportButton);
        this->Controls->Add(this->ExportButton);
        this->Controls->Add(this->PasteMButton);
        this->Controls->Add(this->CopyMButton);
        this->Controls->Add(this->tabControl1);
        this->Controls->Add(this->RemoveButton);
        this->Controls->Add(this->AddButton);
        this->Controls->Add(this->QuestInfoListBox);
        this->Name = "QuestInfoForm";
        this->Text = "QuestInfoForm";
        this->FormClosed += new System::Windows::Forms::FormClosedEventHandler(this->QuestInfoForm_FormClosed);
        this->tabControl1->ResumeLayout(false);
        this->tabPage1->ResumeLayout(false);
        this->QuestInfoPanel->ResumeLayout(false);
        this->QuestInfoPanel->PerformLayout();
        this->ResumeLayout(false);

    }
}
